<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%> 
<html>
<head>  
  <script type="text/javascript">
  var grid;
  $(document).ready(function() {	
	  $.ajax({
		  type: 'POST',
		  url: "../channelinf/getChannelByTp.do?chn_tp=1",				  
		  success: function(data) {	
			  var msg = [];			  
			  for(var i=0;i<data.length;i++){
				  if(i==0){
					  msg.push({ "id": data[i].ID, "text": data[i].TEXT,"selected":true });  
				  }else{					  
				  	  msg.push({ "id": data[i].ID, "text": data[i].TEXT });				  
				  }
			  }			 
			  $("#channel_no").combobox({
				   	data:msg,
				    valueField:'id',
				    textField:'text',
				    panelHeight:'auto',
				    editable:false ,
				    onLoadSuccess:function(param){
				    	var channel_no="";
				    	if(param.length>0){
				    		channel_no=param[0].id;			    		
				    	}
				    	grid = $("#unreporthosttermTableId").jpgrid({
							url: "getUnreportedHostTermListJson.do",
							queryParams: {
								channel_no: channel_no
							}, 
							columns: [
								{title : "会员编号",field : "CUSTOM_NO",align : 'center'}, 
								{title : "会员名称",field : "NAME",align : 'center'}, 
								{title : "会员状态",field : "USER_ST",align : 'center'}, 
								{title : "推荐人",field : "SUP_CUSTOM_NAME",align : 'center'}, 
								{title : "APP所属机构",field : "INS_NAME",align : 'center'}, 
								{title : "所属地区",field : "AREA_CN_NAME",align : 'center'}, 
								{title : "实名认证状态",field : "REALNAME_AUTH_ST",align : 'center'}, 
								{title : "实名认证审核状态",field : "REALNAME_AUDIT_ST",align : 'center'}, 
								{title : "VIP认证状态",field : "VIP_ST",align : 'center'}, 
								{title : "VIP认证时间",field : "VIP_AUTH_TS",align : 'center'}								
							]
						});	
				    }
				}); 			  
	      }
	  });	 
	  	  	  	    
  });
  function doSearch() {	 
	  grid.load({
			channel_no: $('#channel_no').val(),
			custom_no: $('#custom_no').val(),
			phone: $('#phone').val(),
			name: $('#name').val()			
		});
}

function reportToChannel(url){	
	  var channel_no=$("#channel_no").val();
	  if(channel_no==null||channel_no==""||channel_no==undefined){
		  $.jpmessage.info('请选择所属通道！');
		  return;
	  } 
	  var msg="确定向通道"+channel_no+"批量进件吗？";
	  $.jpmessage.confirm(msg, function(r){
			if (r){
				var form = new FormData();
				form.append("channel_no",$("#channel_no").val());
			  	$.ajax({
		          url:url,
		          type:"post",
		          data:form,
		          processData:false,
		          contentType:false,
		          success:function(data){
		          	if("success"==data){
		          		  $.jpmessage.info('进件成功,请稍后刷新查看！');
		          		}else{
		          		  $.jpmessage.info('进件失败！');
		          		}	
		          }
				}); 
			}
		});
}
	/*单个会员进件*/
	function intoSingle(url){
		var channel_no=$("#channel_no").val();
		if(!channel_no){
			$.jpmessage.info('请选择所属通道！');
			return;
		}
		var checkedItems = checkSelected("unreporthosttermTableId", true);
		if(!checkedItems){
			return;
		}
		$.jpajax({
			url: url,
			type: "POST",
			data: {channelNo: channel_no, customerNo: checkedItems[0].CUSTOM_NO},
			success: function(result){
				if("success" === result){
					$.jpmessage.info('会员进件成功,请稍后刷新查看！');
				}else{
					$.jpmessage.info('会员进件失败！');
				}
			}
		});
	}
</script>
</head>



<body class="easyui-layout list_body"  >
	<form id="unreporthosttermForm" name="unreporthosttermForm" method="post" enctype="multipart/form-data">
		<div class="list_body_north" data-options="region:'north'"  border="false" >
			<!-- 查询表单 -->
			<div  class="datagrid-toolbar" border="false"  >
				<span>所属通道:</span>
				<input class="easyui-combobox" id="channel_no" name="channel_no" >  
				<span>会员编号:</span>
				<input id="custom_no" type="text" name="custom_no"  class="easyui-textbox"  >	
				<span>手机号:</span>
				<input id="phone" type="text" name="phone"  class="easyui-textbox"  >	
				<span>会员名称:</span>
				<input id="name" type="text" name="name"  class="easyui-textbox"  >				
													
			 	<a href="#" class="easyui-linkbutton btn" iconCls="icon-search" onclick="doSearch() ">查询</a>
			 	<a href="#" class="easyui-linkbutton btn" iconCls="icon-reload" onclick="resetForm() ">重置</a>			
			</div>
			<!-- 自定义标签工具栏 -->
			<jiepos:buttonOperateTag menuCode="${menuCode}"></jiepos:buttonOperateTag>	
		</div>
		<div data-options="region:'center'" border="false"  class="list_body_center">		
			<!-- 表格 -->
			<table id="unreporthosttermTableId" fit="true"></table>
		</div>
	</form>
</body>

</html>
